<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    

       <script>  

              /* 
                 //call的用法

                 let objObj={
                     name:"xiaoming",
                     age:"18",
                 }
                 function sayCall(title){
                  console.log( title +this.name) 
                 }

                  sayCall.call(objObj,'我的名字是')

              */

                //  谁掉用他 this就指向谁  这个是关键

                 let objObj={
                     name:"xiaoming",
                     age:"18",
                 }
                 function sayCall(title){
                    console.log( title +this.name) 
                 }

                 Function.prototype.newCall=function(obj,...arg){
                        //console.log(this)
                        let sayNamePer=Symbol()
                        obj[sayNamePer]=this
                        let res=obj[sayNamePer](...arg)
                        delete obj[sayNamePer]
                        return res
                  }

                  sayCall.newCall(objObj,'我的名字是')


               

     

       </script>

</body>
</html>